package com.powernode.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.powernode.domain.PickAddr;
import com.powernode.mapper.PickAddrMapper;
import com.powernode.service.PickAddrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PickAddrServiceImpl extends ServiceImpl<PickAddrMapper, PickAddr> implements PickAddrService{
    @Autowired
    private PickAddrMapper pickAddrMapper;

    @Override
    public void selectPickAddrPage(Page<PickAddr> page, PickAddr pickAddr) {
        pickAddrMapper.selectPage(page, new LambdaQueryWrapper<PickAddr>()
            .like(StrUtil.isNotEmpty(pickAddr.getAddrName()), PickAddr::getAddrName, pickAddr.getAddrName())
                .orderByDesc(PickAddr::getProvinceId, PickAddr::getCityId, PickAddr::getAreaId)
            );
    }
}
